import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get/route_manager.dart';
import 'package:ljy_flutter/get/getx_services/getx_services.dart';

class GetxServicesExample extends StatelessWidget {
  const GetxServicesExample({super.key});

  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      title: 'GetX Services Example',
      home: GetxServicesExampleHome(),
    );
  }
}

class GetxServicesExampleHome extends StatelessWidget {
  const GetxServicesExampleHome({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('GetX Services Example'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            const Text('This is a placeholder for GetX Services Example'),
            const SizedBox(height: 20,),
            ElevatedButton(onPressed: (){
              Get.find<GetxServicesTool>().getCount();
            }, child: const Text('服务中的counter加1')),
          ],
        ),
      ),
    );
  }
}